package com.herokuapp.zhachuang.service;

import com.herokuapp.zhachuang.entity.UserProfile;
import com.herokuapp.zhachuang.repository.UserProfileRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 用户资料(服务层)
 *
 * @author
 */
@Service
public class UserProfileService {

	private static final Logger LOGGER = LoggerFactory.getLogger(UserProfileService.class);

	@Autowired
	private UserProfileRepository userProfileRepository;

	public boolean existsByCellular(final String cellular) {
		return userProfileRepository.existsByCellular(cellular);
	}

	public boolean existsByUserId(final String userId) {
		return userProfileRepository.existsByUserId(userId);
	}

	public UserProfile persist(final UserProfile userProfile) {
		return userProfileRepository.saveAndFlush(userProfile);
	}
}
